home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
COMMADIO
/
FSTHST21.LZH
/
FASTHST.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-09-27
|
5KB
|
228 lines
(*
* FSTHST21 - Sets up USR HST Modem for optimum speed
* By Joseph Sheppard, The Ledge PCBoard (818) 352-3620
*
*
* Uses routines from Prokit:
* (C) 1988 Samuel H. Smith, 22-Feb-88 (rev. 12-01-88)
*
*)
(* ------------------------------------------------------------ *)
uses dos,minicrt,tools,proroot,prodata;
const
initial_timeout = 3;
timeout = 3;
max_trys = 5;
var
linenum: integer;
inbuf: string;
lastln: string;
try: integer;
ans: string;
dc: string;
sp: string;
(* ---------------------------------------------------------------- *)
procedure xmit(s: string);
var
i: integer;
begin
for i := 1 to length(s) do
INTR_transmit_data(s[i]);
INTR_flush_com;
end;
(* ---------------------------------------------------------------- *)
procedure recv;
var
c: char;
begin
repeat
if INTR_receive_ready then
c := INTR_receive_data
else
c := #255;
case c of
#255: exit;
' '..'~':
inbuf := inbuf + c;
^J:
if length(inbuf) > 1 then
begin
lastln := inbuf;
inbuf := '';
end;
end;
write(c);
until true=false;
end;
(* ---------------------------------------------------------------- *)
procedure get_user_settings;
begin
clrscr;
writeln('FASTHST V2.1 By Joseph Sheppard, The Ledge PCBoard '+
'818-352-3620');
writeln;
writeln('Be sure that your dipswitches are set as indicated below: ');
writeln;
writeln('1 2 3 4 5 6 7 8 9 10');
writeln('-- -- -- -- -- -- -- -- -- --');
writeln('UP UP DN DN DN UP UP DN UP UP');
writeln;
write('Press any key to continue or Q to Quit ? ');
readln(ans);
stoupper(ans);
if ans[1]='Q' then halt;
clrscr;
writeln('If data compression is enabled, text downloads will be');
writeln('faster, but compressed files (ZIP, ARC, LZH, etc) will be');
writeln('slower. If you will be using your modem mainly for transfering');
writeln('compressed files, your performance will be better of you disable');
writeln('the data compression feature');
writeln;
write('Disable Data Compression (MNP Level 5) Y/N ? ');
readln(ans);
stoupper(ans);
if ans[1]='N' then dc:='&K1';
clrscr;
writeln('FASTHST sets up your modem to send detailed messages to your ');
writeln('terminal program regarding line status (CONNECT, RING, NO CARRIER ');
writeln('NO DIAL TONE, BUSY, NO ANSWER, RINGING, VOICE). You may want to ');
writeln('turn your modem speaker off all the time and monitor the status ');
writeln('of your connection with these silent messages');
writeln;
write('Do you want your modem speaker to always be off? ');
readln(ans);
stoupper(ans);
if ans[1]='N' then sp:='M1';
end;
(* ---------------------------------------------------------------- *)
(*
* main program
*
*)
var
c: char;
port: string;
time: real;
begin
if paramcount <> 1 then
begin
writeln('Usage: FASTHST PORT');
writeln('Example: FASTHST 1');
halt;
end;
dc:='&K0';
sp:='M0';
get_user_settings;
clrscr;
(* install interrupt handlers *)
local := false;
port := paramstr(1);
INTR_init_com(ord(port[1])-ord('1'));
c := '?';
inbuf := '';
lastln := '<timeout>';
time := get_time-timeout+initial_timeout;
try := 1;
repeat
recv;
if {(lastln = '') and} (get_time > time+timeout) then
begin
lastln := '<timeout>';
end;
if (lastln = '<timeout>') or
(lastln = 'RING') or
(lastln = 'NO CARRIER') or
(lastln = 'NO DIAL TONE') then
begin
inc(try);
if try > max_trys then
begin
writeln;
writeln;
writeln('modem is not responding! Process aborted');
writeln;
INTR_uninit_com;
halt;
end;
INTR_lower_dtr;
delay(500);
INTR_raise_dtr;
delay(500);
writeln;
writeln('Resetting modem to factory settings...');
writeln;
writeln('AT&F');
xmit('AT&F'^M);
xmit('AT&W'^M);
delay(500);
writeln;
writeln('Changing NRAM settings...');
writeln;
writeln('ATS7=60E0'+sp+'X6');
writeln;
xmit('ATS7=60E0'+sp+'X6'^M);
delay(500);
writeln('AT&H3&R2&S1&B1'+dc+'&W');
xmit('AT&H3&R2&S1&B1'+dc+'&W'^M);
delay(500);
writeln;
lastln := '';
time := get_time;
end;
if keypressed then
begin
c := readkey;
if c = #27 then
begin
writeln('<user abort>');
INTR_uninit_com;
halt(0);
end;
end;
until lastln = 'OK';
writeln;
writeln('modem setup successful!');
writeln;
writeln('Change the initialization string for your terminal'+
' program to ATH0');
INTR_uninit_com;
halt;
end.